<?php

use App\Models\AdminInfo;
use App\Models\User;
use Illuminate\Database\Seeder;

class UserTableSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        $user = Sentinel::registerAndActivate([
                'username' => 'super-admin',
                'password' => 'super-admin',
                'is_admin' => 1,
                'permissions' => [
                    'user.create' => true,
                    'user.delete' => true,
                    'user.update' => true,
                    'user.view' => true,
                ],
            ]);
        $role = Sentinel::findRoleByName('Admin');
        $role->users()->attach($user);
        AdminInfo::create(['user_id' => $user->id]);



        $user = Sentinel::registerAndActivate([
                'username' => 'admin2',
                'password' => 'admin2',
                'is_admin' => 1,
            ]);
        $role = Sentinel::findRoleByName('Observer');
        $role->users()->attach($user);
        AdminInfo::create(['user_id' => $user->id]);

        Sentinel::registerAndActivate([
                'username' => 'oXwY4t3TWkfU8tI919xshVdOFWzM',
                'password' => 'wxuser11',
            ]);

        Sentinel::registerAndActivate([
                'username' => 'username2',
                'password' => 'wxuser22',
            ]);
    }
}
